/*
-----------------------------------------------------------------------------
This source file is part of Labor3D
(Labor 3D Graphics Engine)

Copyright (c) 2009-2020 Rock Mao
* creator : Rock Mao
* created : 2009-10-25   22:29
* filename: LaborD3DConstLexer.h
-----------------------------------------------------------------------------
*/
#ifndef __LABORD3DCONSTLEXER_H__
#define __LABORD3DCONSTLEXER_H__

#include "LaborD3D10Def.h"
#include "LaborD3D10Headers.h"
#include <d3d10.h>
#include <D3DX10.h>
#include <D3DX10tex.h>
#include <string>
#include <vector>
#include <map>
#include "Mem/stl_dllalloc.h"
NAMESPACE_LABOR3D_BEGIN

struct sLD3D10GIFormatInfo
{
	DXGI_FORMAT   m_dxfmt;
	ds_wstring    m_desc;
	int           m_compont;
	int           m_bytePerComponent;
	eLPIXEL_FORMAT m_fmt;
};
typedef std::map<DXGI_FORMAT   , int> MapsDXGIToIndex;
typedef std::map<eLPIXEL_FORMAT , int> MapsXEvolToIndex;
class CLD3D10ConstLexer
{
	std::vector<sLD3D10GIFormatInfo> m_vForamts;
	MapsDXGIToIndex               m_dxindex;
	MapsXEvolToIndex              m_fmtIndex;
protected:
	void __addDXGIFormat(eLPIXEL_FORMAT fmt , DXGI_FORMAT dxfmt , const wchar_t* descStr , int nCompont , int _byte );
public:
	static CLD3D10ConstLexer* singleton();
	sLD3D10GIFormatInfo*      GetPixelFormat( DXGI_FORMAT dxfmt );
	sLD3D10GIFormatInfo*      GetPixelFormat( eLPIXEL_FORMAT fmt );

	CLD3D10ConstLexer();
	~CLD3D10ConstLexer();

	static D3D10_FILTER               GetFilter(const wchar_t* _min_val , const wchar_t* _mag_val , const wchar_t* _mip_val ,  bool bCamp);
	static D3D10_TEXTURE_ADDRESS_MODE GetAdress(const wchar_t* _addressMode);
	static D3D10_COMPARISON_FUNC      GetCompareFunc(const wchar_t* _func);
	static int                        GetTextureSlotIdx(const wchar_t* _texName);
	static D3D10_BLEND                GetBlendFactor(const wchar_t* _blen);
	static D3D10_BLEND_OP             GetBlendOp(const wchar_t* _blen);
	static D3D10_FILL_MODE            GetFillMode(const wchar_t* _blen);
	static D3D10_CULL_MODE            GetCullMode(const wchar_t* _blen);
	static D3D10_STENCIL_OP           GetStencilOp(const wchar_t* _op);
};

NAMESPACE_LABOR3D_END
#endif // __LABORD3DCONSTLEXER_H__